package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 从文件中读取文本数据
 */
public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream sin = new FileInputStream("fos.txt");
        //通过流估算可以读到多少字节（只是估算）
        int len = sin.available();
        byte[] date = new byte[len];
        sin.read(date);
        String line = new String(date,"UTF-8");
        System.out.println(line);
        sin.close();

    }
}
